/**
 * 
 */
package com.neal.web.controller.message;

import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.neal.domain.Message;
import com.neal.service.IMessageBoardService;

/**
 * @author Neal
 * @version 1.0
 * @description
 */
@Controller
@RequestMapping("/messageList")
public class MessageListController {

	private IMessageBoardService messageBoardService;

	@Autowired
	public MessageListController(IMessageBoardService messageBoardService) {
		this.messageBoardService = messageBoardService;
	}

	@RequestMapping(method = RequestMethod.GET)
	public String generateList(Model model) {
		List<Message> messages = Collections.emptyList();
		messages = messageBoardService.listMessages();
		model.addAttribute("messages", messages);
		return "message/messageList";
	}
	
}
